[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
farrealloc() Adjust Allocated Block in Far Heap
#include <alloc.h>
void far *farrealloc(block,newsize);
void far *block; Allocated block in memory
unsigned long newsize; New size of block
farrealloc() changes the size of an allocated 'block' of memory in
the far heap, changing its size to 'newsize'. If necessary,
farrealloc() also copies the block's contents to a new location.
farrealloc() can reallocate memory from the far heap to include all
of available RAM or reallocate blocks of memory larger than 64K.
Returns: The address of the reallocated block, which may not
be the same as the address of the original block.
NULL is returned if the block cannot be reallocated.
-------------------------------- Example ---------------------------------
The following statements allocate far memory, then resize it and then
deallocate the memory.
#include <alloc.h> /* for farmalloc(), farfree() */
#include <stdio.h> /* for printf and NULL */
main()
{
char far *buf;
char far *temp;
if ((buf = farmalloc(10000L)) == NULL)
printf("not enough memory to allocate");
else {
/* try to make block larger */
if ((temp = farrealloc(buf,15000L)) == NULL)
printf("not enough memory to expand");
else {
buf = temp;
.
.
/* use allocated memory */
}
farfree(buf); /* deallocate memory */
}
}
See Also:
farcalloc()
farcoreleft()
farfree()
farmalloc()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson